#pragma once
#include<stdio.h>
#define maxSize 100
#define maxValue 32767
typedef int DataType;
typedef struct {
	DataType key;
	int link;
}SLNode;

typedef struct {
	SLNode elem[maxSize];
	int n;
}StaticLinkList;

void createSlist(StaticLinkList& SL, DataType A[], int n)
{
	for (int i = 0; i < n; i++)
	{
		SL.elem[i + 1].key = A[i];
		SL.elem[i + 1].link = i + 2;
	}
	SL.elem[0].key = maxValue;
	SL.elem[0].link = 1;
	SL.elem[n].link = 0;
	SL.n = n;
}

void printSList(StaticLinkList& SL)
{
	for (int i = SL.elem[0].link; i != 0; i = SL.elem[i].link)
	{
		printf("%d ", SL.elem[i].key);
	}
	printf("\n");
}